Skip to content

Raise default timeout above the 90s server-side timeout - #60

Open
Babyy-dev wants to merge 1 commit into
serpapi:masterfrom
Babyy-dev:fix-default-timeout
Open

Babyy-dev wants to merge 1 commit into
serpapi:masterfrom
Babyy-dev:fix-default-timeout

Conversation

@Babyy-dev

Copy link
Copy Markdown

Closes #59

The default timeout was 60 seconds, but SerpApi allows a search to run for up to 90 seconds on its side. Any search that finished between 60 and 90 seconds failed in the SDK with RequestTimeoutError, even though SerpApi completed it and the customer was charged for it.

This may also explain #34 (The request was timed out on v2.2.1).

Changes

  • src/config.ts: default timeout 60000 → 95000 (the 90s server timeout plus 5s for network overhead).
  • README: the documented default and the examples now say 95 seconds.
  • tests/validators_test.ts: new test that the default is longer than 90 seconds. afterEach now restores the real default instead of a hard-coded 60000.
  • CHANGELOG entry under Unreleased → Changed.

Testing

  • deno fmt --check, deno lint and deno task test all pass (13 passed, 2 ignored).
  • The new test fails when the default is set back to 60000.

Users who want to fail faster can still set config.timeout or pass timeout per call.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Default client timeout (60s) is shorter than the server-side timeout (90s)

1 participant